﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using GameEngine;
using GameEngine.Graphics;
using GameEngine.Graphics.Light;

namespace GameEngine.Help
{
    static class GameObjektManager
    {
        private static Gegner[] _Gegner;
        private static Spieler _Spieler;

        public static void Init()
        {

        }

        public static void LoadContent(ContentManager Content)
        {
            #region Gegner
            _Gegner = new Gegner[2];
            _Gegner[0] = new Gegner(Content, new Vector2(500, 500));
            _Gegner[1] = new Gegner(Content, new Vector2(650, 500));

            #endregion

            #region Spieler

            _Spieler = new Spieler();
            _Spieler.LoadContent(Content);

            #endregion
        }

        public static void Update()
        {
            _Spieler.Update();
        }

        public static void Draw()
        {
            _Spieler.Draw(Camera.SpriteBatch);

            Camera.SpriteBatch.Begin();
            for (int i = 0; i < _Gegner.Length; i++)
            {
                _Gegner[i].Draw(new Vector2(512, 362));
            }
            Camera.SpriteBatch.End();
        }

        public static void DrawShadows(LightArea LA)
        {
            Camera.SpriteBatch.Draw(_Spieler.Back, LA.ToRelativePosition(new Vector2(512, 362)), null, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f);

            for (int i = 0; i < _Gegner.Length; i++)
            {
                _Gegner[i].DrawShadows(LA);
            }
        }
    }
}
